<?php
use tpfcore\Core;
?>
<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
		<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js">
		</script>
	<![endif]-->
    <link href="{$admin_assets_path}/css/theme.min.css" rel="stylesheet">
    <link href="{$admin_assets_path}/css/simplebootadmin.css" rel="stylesheet">
    <link href="{$admin_assets_path}/css/default.css" rel="stylesheet" />
    <link href="{$admin_assets_path}/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <style>
    .length_3 {
        width: 180px;
    }

    form .input-order {
        margin-bottom: 0px;
        padding: 3px;
        width: 40px;
    }

    .table-actions {
        margin-top: 5px;
        margin-bottom: 5px;
        padding: 0px;
    }

    .table-list {
        margin-bottom: 0px;
    }
    .table-label label{display: inline-block;}
    </style>
    <!--[if IE 7]>
		<link rel="stylesheet" href="{$admin_assets_path}/css/font-awesome-ie7.min.css">
	<![endif]-->
    <script type="text/javascript">
    //全局变量
    var GV = {
        WEB_ROOT: "",
        DIMAUB: "/",
        JS_ROOT: "/theme/backend/assets/js/",
        TOKEN: ""
    };
    </script>
    <!-- Le javascript==================================================-
	-> <!-- Placed at the end of the document so the pages load faster -->
    <script src="{$admin_assets_path}/js/jquery.js"></script>
    <script src="{$admin_assets_path}/js/wind.js"></script>
    <script src="{$admin_assets_path}/js/bootstrap.min.js"></script>
    <link href="{$admin_assets_path}/kindeditor/themes/default/default.css" rel="stylesheet" />
    <script src="{$admin_assets_path}/kindeditor/kindeditor-min.js"></script>
    <script type="text/javascript">
    $(function(){
        $(".input_type input").click(function(){
            if($(this).val()==1){
                $("#input_values").attr("disabled",false);
            }else{
                $("#input_values").attr("disabled",true);
            }
        });
    });
    
    </script>
</head>

<body>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:url('mall/GoodsAttribute/index',['type_id'=>$type_id])}">属性列表</a></li>
            {empty name="list"}
            <li class="active"><a href="{:url('mall/GoodsAttribute/add',['type_id'=>$type_id])}">添加属性</a></li>
            {else/}
            <li><a href="{:url('mall/GoodsAttribute/add',['type_id'=>$type_id])}">添加属性</a></li>
            <li class="active"><a href="{:url('mall/GoodsAttribute/add',['id'=>$list[0]->id])}">编辑属性</a></li>
            {/empty}
        </ul>
        <form method="post" class="form-horizontal js-ajax-form" action="{:url('mall/GoodsAttribute/add')}">
        	{notempty name="list"}
        	<input type="hidden" name="id" value="{$list[0]->id}" />
        	{/notempty}
            <fieldset>
                <div class="">
                    <table class="table table-bordered">
                        <tbody>
                            <tr>
                                <th width="80">属性名称</th>
                                <td>
                                    <input type="text" name="name" value="{$list[0]->name|default=''}" placeholder="请输入属性名称"> <span class="form-required">*</span>
                                </td>
                            </tr>
                            <tr>
                                <th width="80">所属商品类型</th>
                                <td>
                                    <select name="type_id">
                                        {volist name="listGoodsType" id="vo"}
                                        <option value="{$vo.id}" {notempty name="list"}{eq name="vo.id" value="$list[0]->type_id"}selected="selected"{/eq}{else/}{eq name="type_id" value="$vo.id"}selected="selected"{/eq}{/notempty}>{$vo.name}</option>
                                        {/volist}
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <th width="80">属性是否可选</th>
                                <td class="table-label">
                                    <label><input type="radio" name="select_type" value="0" {notempty name="list"}{eq name="list[0]->select_type" value="0"}checked="checked"{/eq}{/notempty}/> 唯一属性</label>
                                    <label><input type="radio" name="select_type" value="1" {notempty name="list"}{eq name="list[0]->select_type" value="1"}checked="checked"{/eq}{/notempty}/> 单选属性</label>
                                    <label><input type="radio" name="select_type" value="2" {notempty name="list"}{eq name="list[0]->select_type" value="2"}checked="checked"{/eq}{/notempty}/> 复选属性</label>
                                </td>
                            </tr>
                            <tr>
                                <th width="80">该属性值的录入方式</th>
                                <td class="table-label input_type">
                                    <label><input type="radio" name="input_type" value="0" {notempty name="list"}{eq name="list[0]->input_type" value="0"}checked="checked"{/eq}{/notempty}/> 手工录入</label>
                                    <label><input type="radio" name="input_type" value="1" {notempty name="list"}{eq name="list[0]->input_type" value="1"}checked="checked"{/eq}{/notempty}/> 从下面的列表中选择（一行代表一个可选值）</label>
                                    <label><input type="radio" name="input_type" value="2" {notempty name="list"}{eq name="list[0]->input_type" value="2"}checked="checked"{/eq}{/notempty}/> 多行文本框</label>
                                </td>
                            </tr>
                            
                            <tr>
                                <th>可选值列表</th>
                                <td>
                                    <textarea style="width: 300px; height: 120px;" name="input_values" id="input_values" {notempty name="list"}{if condition="$list[0]->input_type neq 1"}disabled="disabled"{/if}{/notempty}>{$list[0]->input_values|default=''}</textarea>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </fieldset>
            <div class="form-actions">
                <button class="btn btn-primary js-ajax-button" type="button">确定操作</button>
                <a class="btn" href="javascript:history.back(-1);">返回</a>
            </div>
        </form>
    </div>
    <script src="{$admin_assets_path}/js/common.js"></script>
</body>

</html>